home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 20.7 KB | 683 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: Results Express.lib
- #
- # Contains: xxx put contents here xxx
- #
- # Written by: PUT NAMES OF ALL SOFTWARE AUTHORS HERE
- #
- # Copyright: © 1995-1997 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # 1.1.0 02/12/97 JAS Added 'vers' resources to library.
- # These should always match tool version when tool is revved.
- # <12> 11/8/95 ML NewMatrix - declared kNewMatrixID as global
- #
- # ****************************************************************************
- #
-
- #
- # File: Results Express.lib
- #
- # Contains: Virtual User task library for calling Results Express
- #
- # Written by: RV
- #
- # Copyright: © 1994-1997 by Apple Computer, Inc., all rights reserved.
- #
- # Change History (most recent first):
- #
- # 7/19/94 RV xxx put comment here xxx
- #
- # To Do:
- #
-
- Libraries "Results Express.vutool";
-
- #######################################################################################
- # InitResultsExpress
- #
- # Prepares Results Express as an external tool.
- # This task must be called before any other task from this library
- #
- # Input:
- #
- # OnTarget
- # Pass in true if Results Express is to run on a target, false for the Host.
- # By default Memory Monitor runs on the Host
- #
- #######################################################################################
- Task InitResultsExpress( OnTarget := false )
- Begin
- global kREMatrixKind := 1;
- global kRESuiteKind := 2;
- global kRETargetKind := 3;
- global kRETestCaseKind := 4;
- global kRETestSpecKind := 5;
- global kRESysFileKind := 6;
-
- global kREDefaultMatrixID := 0;
- global kREInvalidID := -1;
- global kNewMatrixID := -2;
-
- x := ResultsExpress( "Initialize", OnTarget ); # Launch Results Express on the Host
- SErr := ScriptError();
- x := x + { SErr };
- ReportError( "InitResultsExpress", x );
- return x;
- end;
-
- #######################################################################################
- # QuitResultsExpress()
- #
- # Causes Results Express application to 'Quit'.
- #
- #######################################################################################
- Task QuitResultsExpress()
- Begin
- x := ResultsExpress( "Quit" );
- SErr := ScriptError();
- x := x + { SErr };
- ReportError( "QuitResultsExpress", x );
- return x;
- end;
-
- #######################################################################################
- # NewMatrix( pFields := {},
- # pCallAsync := false )
- #
- # Creates a new Matrix record with a unique ID. Adds the data contained in pFields
- # to the new record and returns the unique ID.
- #
- # Input:
- #
- # pFields list
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs. i.e. { { label1, value1 },{ label2, value2 }, ... }
- # Example: pFields = { { "MatrixName", "QuickLooks Matrix" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task NewMatrix( pFields := {},
- pCallAsync := false )
- Begin
- x := NewRecord( global kREMatrixKind,
- global kNewMatrixID,
- pFields,
- pCallAsync );
- ReportError( "NewMatrix", x );
- return x;
- end;
-
- #######################################################################################
- # AddMatrixFields( pMatrixID := global kREDefaultMatrixID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Adds data to an existing record, identified by ID
- #
- # Input:
- #
- # pMatrixID string or integer The ID of the record to modify
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "MatrixName", "QuickLooks" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task AddMatrixFields( pMatrixID := global kREDefaultMatrixID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := SetFields( global kREMatrixKind,
- pMatrixID,
- pFields,
- pCallAsync );
- ReportError( "AddMatrixFields", x );
- return x;
- end;
-
- #######################################################################################
- # NewSuite( pMatrixID := global kREDefaultMatrixID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Creates a new Suite record with a unique ID. Adds the data contained in pFields
- # to the new record and returns the unique ID ( as the 2nd item in return list ).
- #
- # Input:
- #
- # pMatrixID string or integer
- # The unique ID of the Matrix to contain this suite record. i.e. specifies the
- # parent record of the newly created record.
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "SuiteName", "MacWrite QuickLook" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task NewSuite( pMatrixID := global kREDefaultMatrixID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := NewRecord( global kRESuiteKind,
- pMatrixID,
- pFields,
- pCallAsync );
- ReportError( "NewSuite", x );
- return x;
- end;
-
- #######################################################################################
- # AddSuiteFields( pSuiteID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Adds data to an existing record, identified by ID
- #
- # Input:
- #
- # pSuiteID string or integer The ID of the record to modify
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "MatrixName", "QuickLooks" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task AddSuiteFields( pSuiteID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := SetFields( global kRESuiteKind,
- pSuiteID,
- pFields,
- pCallAsync );
- ReportError( "AddSuiteFields", x );
- return x;
- end;
-
- #######################################################################################
- # NewTestCase( pSuiteID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Creates a new Test Case record with a unique ID. Adds the data contained in pFields
- # to the new record and returns the unique ID ( as the 2nd item in return list ).
- #
- # Input:
- #
- # pSuiteID string or integer
- # The unique ID of the Suite to contain this Test Case record. i.e. specifies the
- # parent record of the newly created record.
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "SuiteName", "MacWrite QuickLook" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task NewTestCase( pSuiteID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := NewRecord( global kRETestCaseKind,
- pSuiteID,
- pFields,
- pCallAsync );
- ReportError( "NewTestCase", x );
- return x;
- end;
-
- #######################################################################################
- # AddTestCaseFields( pTestCaseID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Adds data to an existing record, identified by ID
- #
- # Input:
- #
- # pTestCaseID string or integer The ID of the record to modify
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "MatrixName", "QuickLooks" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task AddTestCaseFields( pTestCaseID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := SetFields( global kRETestCaseKind,
- pTestCaseID,
- pFields,
- pCallAsync );
- ReportError( "AddTestCaseFields", x );
- return x;
- end;
-
- #######################################################################################
- # NewTarget( pMatrixID := global kREDefaultMatrixID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Creates a new Target record with a unique ID. Adds the data contained in pFields
- # to the new record and returns the unique ID ( as the 2nd item in return list ).
- #
- # Input:
- #
- # pMatrixID string or integer
- # The unique ID of the Matrix to contain this target record. i.e. specifies the
- # parent record of the newly created record.
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "SuiteName", "MacWrite QuickLook" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task NewTarget( pMatrixID := global kREDefaultMatrixID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := NewRecord( global kRETargetKind,
- pMatrixID,
- pFields,
- pCallAsync );
- ReportError( "NewTarget", x );
- return x;
- end;
-
- #######################################################################################
- # AddTargetFields( pTargetID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Adds data to an existing record, identified by ID
- #
- # Input:
- #
- # pTargetID string or integer The ID of the record to modify
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "MatrixName", "QuickLooks" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task AddTargetFields( pTargetID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := SetFields( global kRETargetKind,
- pTargetID,
- pFields,
- pCallAsync );
- ReportError( "AddTargetFields", x );
- return x;
- end;
-
- #######################################################################################
- # NewSystemFile( pTargetID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Creates a new System File record with a unique ID. Adds the data contained in pFields
- # to the new record and returns the unique ID ( as the 2nd item in return list ).
- #
- # Input:
- #
- # pTargetID string or integer
- # The unique ID of the Target to contain this System File record. i.e. specifies the
- # parent record of the newly created record.
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "SuiteName", "MacWrite QuickLook" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task NewSystemFile( pTargetID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := NewRecord( global kRESysFileKind,
- pTargetID,
- pFields,
- pCallAsync );
- ReportError( "NewSystemFile", x );
- return x;
- end;
-
- #######################################################################################
- # AddSystemFileFields( pSysFileID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Adds data to an existing record, identified by ID
- #
- # Input:
- #
- # pSysFileID string or integer The ID of the record to modify
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "MatrixName", "QuickLooks" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task AddSystemFileFields( pSysFileID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := SetFields( global kRESysFileKind,
- pSysFileID,
- pFields,
- pCallAsync );
- ReportError( "AddSystemFileFields", x );
- return x;
- end;
-
- #######################################################################################
- # NewTestSpecification( pMatrixID := global kREDefaultMatrixID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Creates a new Test Specification record with a unique ID. Adds the data contained in pFields
- # to the new record and returns the unique ID ( as the 2nd item in return list ).
- #
- # Input:
- #
- # pMatrixID string or integer
- # The unique ID of the Matrix to contain this Test Specification record. i.e. specifies the
- # parent record of the newly created record.
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "SuiteName", "MacWrite QuickLook" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task NewTestSpecification( pMatrixID := global kREDefaultMatrixID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := NewRecord( global kRETestSpecKind,
- pMatrixID,
- pFields,
- pCallAsync );
- ReportError( "NewTestSpecification", x );
- return x;
- end;
-
- #######################################################################################
- # AddTestSpecificationFields( pTestSpecID,
- # pFields := {},
- # pCallAsync := false )
- #
- # Adds data to an existing record, identified by ID
- #
- # Input:
- #
- # pTestSpecID string or integer The ID of the record to modify
- #
- # pFields
- # A list of data to be stored in the record. pFields is a list of
- # label and value pairs.
- # Example: pFields = { { "MatrixName", "QuickLooks" },
- # { "StartDate", "10:23:45 AM" }, ... }
- #
- # pCallAsync boolean Determines wheather the tool is called asynchronously
- #
- #######################################################################################
- Task AddTestSpecificationFields( pTestSpecID,
- pFields := {},
- pCallAsync := false )
- Begin
- x := SetFields( global kRETestSpecKind,
- pTestSpecID,
- pFields,
- pCallAsync );
- ReportError( "AddTestSpecificationFields", x );
- return x;
- end;
-
- #######################################################################################
- # NewRecord( pRecordKind,
- # pParentID,
- # pFields,
- # pCallAsync := false )
- #
- # This task calls Results Express to create a new record, containing
- # the specified field data, within the specified parent record.
- #
- # Input:
- #
- # pRecordKind - integer code indicating the type of record
- # pParentID - integer integer code specifying the Parent of the new record
- # pFields - list list list of label value pairs (a list of lists)
- # pCallAsync - boolean make call to R.E. asynchronously if true
- #
- # Output:
- # returns - list { ErrCode, Result, ErrMsg, ScriptErr }
- # item 1 - integer ErrCode: zero for no errors
- # item 2 - any Result: the ID of the newly created record
- # item 3 - integer ErrMsg: error message
- # item 4 - integer ScriptErr: the script error just after R.E. tool call
- #
- # Example:
- # tMatrixID := NewMatrix( tFields );
- # tFields := { {"SuiteName", "Example Suite" } };
- # SetFields( kRESuiteKind, tSuiteID, tFields );
- #
- # Assumptions: The Suite record must already exist and the ID must
- # originally come from the NewRecord call which created it.
- #######################################################################################
- Task NewRecord( pRecordKind,
- pParentID,
- pFields,
- pCallAsync := false )
- Begin
-
- x := ResultsExpress( "NewRecord",
- pRecordKind,
- pParentID,
- pFields ) Async:pCallAsync;
-
- SErr := ScriptError();
- x := x + { SErr };
- return x;
- end;
-
- #######################################################################################
- # SetFields( pRecordKind,
- # pRecordID,
- # pFields,
- # pCallAsync := false )
- #
- # This task calls Results Express to append fields to an
- # existing record. A field in the record which already
- # contains a value will be over written.
- #
- # Input:
- #
- # pRecordKind - integer code indicating the type of record
- # pRecordID - integer integer code specifying which record
- # pFields - list list list of label value pairs (a list of lists)
- # pCallAsync - boolean make call to R.E. asynchronously if true
- #
- # Output:
- # returns - list { ErrCode, Result, ErrMsg, ScriptErr }
- # item 1 - integer ErrCode: zero for no errors
- # item 2 - any Result: the ID of the record operated upon
- # item 3 - integer ErrMsg: error message
- # item 4 - integer ScriptErr: the script error just after R.E. tool call
- #
- # Example:
- # tSuiteID := NewSuite( kRESuiteKind, gMatrixID, tFields );
- # tFields := { {"SuiteVal", 1 } };
- # SetFields( kRESuiteKind, tSuiteID, tFields );
- #
- # Assumptions: The Suite record must already exist and the ID must
- # originally come from the NewRecord call which created it.
- #######################################################################################
- Task SetFields( pRecordKind,
- pRecordID,
- pFields,
- pCallAsync := false )
- Begin
- x := ResultsExpress( "SetFields",
- pRecordKind,
- pRecordID,
- pFields ) Async:pCallAsync;
- SErr := ScriptError();
- x := x + { SErr };
- return x;
- end;
-
- #######################################################################################
- # Consolidate( pMatrixID := 0,
- # pMatrixName := '',
- # pPutInDropFolder := false,
- # pPreserveRawData := true,
- # pCallAsync := false )
- #
- # Creates a Phoenix import file from the existing data within a Matrix.
- # If no Matrix ID is provided, the default Matrix (ID of zero) is Consolidated.
- # The Phoenix import file is created within the Matrix folder named with the
- # Matrix ID, in the Matrices folder, adjacent to the Results Express application.
- #
- # Input:
- #
- # pMatrixID - string or integer
- # The ID of the matrix to generate import file from
- #
- # pMatrixName - string
- # Name to be given to the Matrix
- #
- # pPutInDropFolder - Boolean (symbol true | false )
- # If true, generated Import file is put into
- # the current R.E. Drop Folder
- #
- # pCallAsync - boolean make call to R.E. asynchronously if true
- #
- #######################################################################################
- Task Consolidate( pMatrixID := 0,
- pMatrixName := '',
- pPutInDropFolder := false,
- pPreserveRawData := true,
- pCallAsync := false )
- Begin
- x := ResultsExpress( "Consolidate",
- pMatrixID ,
- pMatrixName,
- pPutInDropFolder,
- pPreserveRawData ) Async:pCallAsync;
- SErr := ScriptError();
- x := x + { SErr };
- ReportError( "Consolidate", x );
- return x;
- end;
-
- #######################################################################################
- # ReportError( pTaskName, pResult )
- #
- # Print error message to Notebook if pResult indicates an error
- #
- # Input:
- #
- # pOperationName - string
- # The name of the operation which encountered an error
- #
- # pResult - list
- # Results Express return value to check for errors
- #
- # Output:
- # Returns: nothing
- # Notebook recieves Println statments.
- #######################################################################################
- Task ReportError( pOperationName, pResult )
- Begin
- if ( (pResult[1] <> 0) or (pResult[4] <> 0) )
- begin
- Println "# Error during ", pOperationName;
- Println "# Error Code = ", pResult[1];
- Println "# Return Value = ", pResult[2];
- Println "# Error Msg = ", pResult[3];
- Println "# Script Err = ", pResult[4];
- end;
- end;
-
- #######################################################################################
- # EqualREIDs( pID1, pID2 )
- #
- # Compares the IDs and returns true if they are the same
- # otherwise it returns false.
- # This task is needed since IDs can be of two types, integer or string.
- # A straight if( id1 = id2 ) ... will not work
- #
- # Input:
- #
- # pID1 and pID2 string or integer The IDs to be compared
- #
- #######################################################################################
- Task EqualREIDs( pID1, pID2 )
- Begin
- ### Convert both IDs to string values if needed
- if( TypeOf( pID1 ) = 'integer' )
- begin
- pID1 := numtostr( pID1 );
- end;
-
- if( TypeOf( pID2 ) = 'integer' )
- begin
- pID2 := numtostr( pID2 );
- end;
-
- ### Now compare the values
- return pID1 = pID2;
- end;
-
-